#include <iostream>
#include <unistd.h>
#include <cstring>
#include <sys/wait.h>
#include <sys/stat.h>
#include <signal.h>

using namespace std;

void sigcb(int signo)
{
    cout << "get a signo : " << signo << endl;
}

int main()
{
    struct sigaction sa, osa;
    memset(&sa, 0, sizeof(sa));
    memset(&osa, 0, sizeof(osa));
    sa.sa_handler = sigcb;
    sigaction(SIGINT,&sa,&osa);

    while(true)
    {
        cout << "I am a process id: " << getpid() << endl;
        sleep(1);
    }

    return 0;
}